3.1.86 \(\int \frac {\tan (x)}{1+\cos ^2(x)} \, dx\) [86]

Optimal. Leaf size=17 \[ -\log (\cos (x))+\frac {1}{2} \log \left (1+\cos ^2(x)\right ) \]

[Out]

-ln(cos(x))+1/2*ln(1+cos(x)^2)

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.364, Rules used = {3273, 36, 29, 31} \begin {gather*} \frac {1}{2} \log \left (\cos ^2(x)+1\right )-\log (\cos (x)) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Tan[x]/(1 + Cos[x]^2),x]

[Out]

-Log[Cos[x]] + Log[1 + Cos[x]^2]/2

Rule 29

Int[(x_)^(-1), x_Symbol] :> Simp[Log[x], x]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 36

Int[1/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Dist[b/(b*c - a*d), Int[1/(a + b*x), x], x] -
Dist[d/(b*c - a*d), Int[1/(c + d*x), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0]

Rule 3273

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.)*tan[(e_.) + (f_.)*(x_)]^(m_.), x_Symbol] :> With[{ff = Free
Factors[Sin[e + f*x]^2, x]}, Dist[ff^((m + 1)/2)/(2*f), Subst[Int[x^((m - 1)/2)*((a + b*ff*x)^p/(1 - ff*x)^((m
 + 1)/2)), x], x, Sin[e + f*x]^2/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rubi steps

\begin {align*} \int \frac {\tan (x)}{1+\cos ^2(x)} \, dx &=-\left (\frac {1}{2} \text {Subst}\left (\int \frac {1}{x (1+x)} \, dx,x,\cos ^2(x)\right )\right )\\ &=-\left (\frac {1}{2} \text {Subst}\left (\int \frac {1}{x} \, dx,x,\cos ^2(x)\right )\right )+\frac {1}{2} \text {Subst}\left (\int \frac {1}{1+x} \, dx,x,\cos ^2(x)\right )\\ &=-\log (\cos (x))+\frac {1}{2} \log \left (1+\cos ^2(x)\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 17, normalized size = 1.00 \begin {gather*} -\log (\cos (x))+\frac {1}{2} \log \left (1+\cos ^2(x)\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Tan[x]/(1 + Cos[x]^2),x]

[Out]

-Log[Cos[x]] + Log[1 + Cos[x]^2]/2

________________________________________________________________________________________

Maple [A]
time = 0.08, size = 16, normalized size = 0.94

method result size
derivativedivides \(-\ln \left (\cos \left (x \right )\right )+\frac {\ln \left (1+\cos ^{2}\left (x \right )\right )}{2}\) \(16\)
default \(-\ln \left (\cos \left (x \right )\right )+\frac {\ln \left (1+\cos ^{2}\left (x \right )\right )}{2}\) \(16\)
risch \(-\ln \left ({\mathrm e}^{2 i x}+1\right )+\frac {\ln \left ({\mathrm e}^{4 i x}+6 \,{\mathrm e}^{2 i x}+1\right )}{2}\) \(29\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(x)/(1+cos(x)^2),x,method=_RETURNVERBOSE)

[Out]

-ln(cos(x))+1/2*ln(1+cos(x)^2)

________________________________________________________________________________________

Maxima [A]
time = 0.26, size = 19, normalized size = 1.12 \begin {gather*} -\frac {1}{2} \, \log \left (\sin \left (x\right )^{2} - 1\right ) + \frac {1}{2} \, \log \left (\sin \left (x\right )^{2} - 2\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(x)/(1+cos(x)^2),x, algorithm="maxima")

[Out]

-1/2*log(sin(x)^2 - 1) + 1/2*log(sin(x)^2 - 2)

________________________________________________________________________________________

Fricas [A]
time = 0.54, size = 19, normalized size = 1.12 \begin {gather*} \frac {1}{2} \, \log \left (\frac {1}{2} \, \cos \left (x\right )^{2} + \frac {1}{2}\right ) - \log \left (-\cos \left (x\right )\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(x)/(1+cos(x)^2),x, algorithm="fricas")

[Out]

1/2*log(1/2*cos(x)^2 + 1/2) - log(-cos(x))

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\tan {\left (x \right )}}{\cos ^{2}{\left (x \right )} + 1}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(x)/(1+cos(x)**2),x)

[Out]

Integral(tan(x)/(cos(x)**2 + 1), x)

________________________________________________________________________________________

Giac [A]
time = 0.48, size = 16, normalized size = 0.94 \begin {gather*} \frac {1}{2} \, \log \left (\cos \left (x\right )^{2} + 1\right ) - \log \left ({\left | \cos \left (x\right ) \right |}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(x)/(1+cos(x)^2),x, algorithm="giac")

[Out]

1/2*log(cos(x)^2 + 1) - log(abs(cos(x)))

________________________________________________________________________________________

Mupad [B]
time = 2.16, size = 9, normalized size = 0.53 \begin {gather*} \frac {\ln \left ({\mathrm {tan}\left (x\right )}^2+2\right )}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(x)/(cos(x)^2 + 1),x)

[Out]

log(tan(x)^2 + 2)/2

________________________________________________________________________________________